import request from '@/utils/request'

// 列表
export const userList = ({ name, page, pageSize }) => {
  return request.get('/park/sys/user', {
    params: {
      name,
      page,
      pageSize
    }
  })
}

// 删除列表
export const delList = (id) => {
  return request.delete(`park/sys/user/${id}`)
}

// 分配角色
export const getRole = (id) => {
  return request.get(`/park/sys/role`)
}

// 添加列表
export const addList = ({ name, userName, roleId, status, phonenumber }) => {
  return request.post('/park/sys/user', {
    name, userName, roleId: +roleId, status: status, phonenumber
  })
}
// 点击编辑后回显
export const editList = (id) => {
  return request.get(`park/sys/user/${id}`)
}
// 点击编辑后确定
export const editSubmitList = ({ id, name, userName, roleId, status, phonenumber }) => {
  return request.put('/park/sys/user', {
    id, name, userName, roleId, status, phonenumber
  })
}
// 点击重置
export const resetPassword = (id) => {
  return request.put('/park/sys/user/resetPwd', {
    id
  })
}
